<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<%@include file="./../include/stdlib.jspf" %>
<!DOCTYPE html>
<html lang="en">
<head>
    <%@include file="include/meta.jspf" %>
    <title>故障工单</title>
    <link rel="stylesheet" href="${root}/static/wechat/css.css">
    <link rel="stylesheet" href="${root}/static/wechat/index.css">
    <%@include file="include/script.jspf" %>
</head>
<body style="background-color: #f6f6f6">
<!--content start-->
<!--内容部分-->
<c:choose>
    <c:when test="${wxUser != null}">
        <input type="hidden" id="adCompanyId" value="${wxUser.orgId}">
        <div class="content_from">
            <h3>已处理工单</h3>
            <table border="1">
                <thead>
                <tr>
                    <th>广告牌</th>
                    <th>维修人</th>
                    <th colspan="2">查看</th>
                </tr>
                </thead>
                <tbody id="billboardMalfunction1-list-body">

                </tbody>
            </table>
            <div class="text-center2">
                <ul class="uuuu">

                </ul>
            </div>
        </div>
         <script type="text/template" id="billboardMalfunction1-list-template">
             <@ _.each(items, function (item) { @>
             <tr>
                 <td><a href="wechat/billboard_details?id=<@= item[0].billboard.id @>"><@= item[0].billboard.code @></a></td>
                 <td><a href="wechat/wxUser_details?id=<@= item[0].repairManId @>#mp.weixin.qq.com"><@= item[0].repairMan==null?"":item[0].repairMan.realName @></a></td>
                 <td><a href="wechat/billboardMalfunction_details?id=<@= item[0].id @>">详情</a></td>
             </tr>
             <@ }); @>
         </script>
         <script type="text/template" id="billboardMalfunction1-page-template">
             <@ for(var index=1;index<=totalPages;index++) { @>
             <@ if(number==index-1) {@>
             <li class="list"><a class="aaaa font" style="color: #fff" href="javascript:void(0)"
                                 data-index="<@=index @>"><@=index @></a></li>
             <@ } else { @>
             <li><a class="aaaa" href="javascript:void(0)" data-index="<@=index @>"><@=index @></a></li>
             <@ }} @>
         </script>
        <script type="application/javascript">
            $(".text-center li").click(function () {
                $(this).addClass("list");
                $(this).find("a").addClass("font");
                $(".text-center li").not($(this)).removeClass("list");
                $(".text-center li a").not($(this).find("a")).removeClass("font");
            });
            $(".text-center2 li").click(function () {
                $(this).addClass("list");
                $(this).find("a").addClass("font");
                $(".text-center2 li").not($(this)).removeClass("list");
                $(".text-center2 li a").not($(this).find("a")).removeClass("font");
            });
            $utils.setting_template();
            function load(page) {
                if (page == null) {
                    page = 1;
                }
                var adCompanyId = $('#adCompanyId').val();
                request.authPost("resources/billboardMalfunction/ok/list_myself", {
                    adCompanyId: adCompanyId,
                    page: page
                }, function (data) {
                    console.log(data);
                    if (data == null) {
                        return;
                    }
                    var tmpl = _.template($('#billboardMalfunction1-list-template').html());
                    $('#billboardMalfunction1-list-body').html(tmpl({items: data.content}));

                    var tmpl_page = _.template($('#billboardMalfunction1-page-template').html());
                    $('.uuuu').html(tmpl_page({totalPages: data.totalPages, number: data.number}));

                    $('.uuuu .aaaa').click(function () {
                        load($(this).data("index"));
                    });
                });

            }
            load();

        </script>
    </c:when>
    <c:otherwise>
        <div style="text-align: center;margin-top: 20%;">
            <i class="icon icon-remove" style="color:red;">您还没有绑定用户，请先去绑定</i>
        </div>
        <br>
        <div class="poster_but">
            <input id="bind" type="button" value="绑定">
        </div>
    </c:otherwise>
</c:choose>
</body>
<script>
    $("#bind").click(function () {
        location.href = "${root}/wechat/binding";
    });
</script>
</html>
